/* @cash trade npc
*/
var status = -1;

function action(mode, type, selection) {
    if (mode == 1) {
	status++;
    } else {
	if (status == 2) {
	    cm.sendNext("test");
	}
	status--;
    }
    if (status == 0) {
	cm.sendSimple("Hello i am the @Cash item trader. I can trade you nice items in exchange for some @cash. \r\nYou currently have "+ cm.getNX() +" @cash \r\n \r\n Select your reward:\r\nTeir 0: \r\n #L0#100 Onyx Apples - 75k @cash#l \r\n#L1#Moon Star chair - 100k @cash#l \r\n#L2#100 Gatchapon tickets - 100k @cash#l \r\n #L3#Pink Seal cushion - 100k @cash#l \r\n #L4#Blue Seal cushion - 100k @cash#l \r\n #L5#Crystal Ilbi throwing stars - 100K @cash#l \r\n #L6#Magic throwing knifes - 350K @Cash#l");
    } else if (status == 1) {
	if (selection == 0) { //Onyx Apples
	if ( cm.getNX() >= 75000 ) {
				cm.gainNX(-75000);
				cm.gainItem(2022179, 100);
				cm.sendNext("You have recieved 100 onyx apples!");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 75k @cash");
				cm.dispose();
				}
	} else if (selection ==1) { //Moon star chair
	if ( cm.getNX() >= 100000 ) {
				cm.gainNX(-100000);
				cm.gainItem(3010014, 1);
				cm.sendNext("You have recieved Moon star chair!");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 100k @cash");
				cm.dispose();
				}

	} else if (selection == 2) { //100 gatchapon
		if ( cm.getNX() >= 100000 ) {
				cm.gainNX(-100000);
				cm.gainItem(5220000, 100);
				cm.sendNext("You have recieved 100 gachapon tickets!");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 100k @cash");
				cm.dispose();
				}
	} else if (selection == 3) { //Pink seal cushion
		if ( cm.getNX() >= 100000 ) {
				cm.gainNX(-100000);
				cm.gainItem(3010007, 1);
				cm.sendNext("You have recieved Pink seal cushion!");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 100k @cash");
				cm.dispose();
				}
		} else if (selection == 4) { //Blue seal cushion
		if ( cm.getNX() >= 100000 ) {
				cm.gainNX(-100000);
				cm.gainItem(3010008, 1);
				cm.sendNext("You have recieved Blue seal cushion!");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 100k @cash");
				cm.dispose();
				}
		} else if (selection == 5) { //Ilbi
		if ( cm.getNX() >= 100000 ) {
				cm.gainNX(-100000);
				cm.gainItem(2070016, 800);
				cm.sendNext("You have recieved Crystal Ilbi throwing stars");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 100k @cash");
				cm.dispose();
				}
		} else if (selection == 6) { //Ilbi
		if ( cm.getNX() >= 350000 ) {
				cm.gainNX(-350000);
				cm.gainItem(2070019, 800);
				cm.sendNext("You have recieved Magic Throwing Stars");
				cm.dispose();
				} else {
				cm.sendNext("You dont have 350k @cash");
				cm.dispose();
				}

}
}
}


